package library;

public class BookList {
    private Book[] books = new Book[1024];
    //当前数组中有效元素的数量
    //数组元素都是默认null
    private int size = 0;

    public BookList() {
        books[0] = new Book("西游记", "吴承恩", 100, "古典小说");
        books[1] = new Book("红楼梦", "曹雪芹", 90, "古典小说");
        books[2] = new Book("高等数学", "高斯", 40, "数学");
        books[3] = new Book("java入门到精通", "詹姆斯高斯林", 70, "计算机");
        books[4] = new Book("西游记", "吴承恩", 100, "古典小说");
        size = 4;
    }

    //    public Book[] getBooks() {
//        return books;
//    }
//
//    public void setBooks(Book[] books) {
//        this.books = books;
//    }
    public int getSize () {
        return size;
    }

    public void setSize (int size){
        this.size = size;
    }

    public Book getBook(int index) {
        return books[index];
    }

    public void setBook(int index, Book book) {
        books[index] = book;
    }
}
